package thread;

import java.util.Scanner;

/*
* Sleep阻塞
* 线程提供了一个静态方法:sleep,该方法可以让当前线程进入阻塞状态指定毫秒,超时后线程回自动回到RUNNABLE
* 状态再次并发
*
* */
public class SleepDemo {
    public static void main(String[] args) {
        /*
        * */
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入倒计时时间:");
        int minth = scan.nextInt();
        for(int i=minth;i>0;i--){
            System.out.println(i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("结束！");
      /*  System.out.println("程序开始了");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("程序结束了");*/

    }
}
